home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Click 1 (Special Issue) / fantasy.iso / Demo The Druid King / DemoMap.pak / SEQUENCES_S05_MAIN.VS < prev    next >
Text File  |  2001-04-11  |  7KB  |  215 lines

  1. //void
  2. Conversation conv;
  3. NamedObj Keltill, Daranix, Pavonius, Dumnorix, Ogox, Mrax;
  4. ObjSet RomanArmy, TeutonArmy, TeutonHorde, TeutonHorde2, TeutonHorde3, GaulsOutpost;
  5. Building outpost;
  6. TPoint pt;
  7. bool bMessageDelivered, bPavoniusHere, bFirst, bFirst2;
  8. ObjList dummy;
  9. TRect rc, rcBattle;
  10. int nTeutons, tmBattle;
  11. int count;
  12.  
  13. /*
  14. //init part - remove this afterwards
  15.  
  16.     CreateNamedObj("Keltill", PlaceEx("Keltill", 1400, 12500, 1));
  17.     CreateNamedObj("Daranix", PlaceEx("Daranix", 1600, 12500, 1));
  18.  
  19.     PlaceBlockEx("Pretorian", 3, 3200, 9000, 5, 5, 50, 50, "PavoniusArmy");
  20.     CreateNamedObj("Pavonius", PlaceEx("Pavonius", 3350, 8900, 3));
  21.     RomanArmy = GetObjSet("PavoniusArmy");
  22.  
  23.     Pavonius = GetNamedObj("Pavonius");
  24.     RomanArmy.AddCommand(true,"attach", Pavonius.obj);
  25.     RomanArmy.KillCommand();
  26.  
  27.     PlayersShareView(1,3);
  28.  
  29.     EnvWriteString("/DM C1/Return Value", "stay");
  30. */
  31. //init part - this must remain
  32.     PlayersAlly(1,3);
  33.     PlayersAlly(3,4);
  34.     PlayersAlly(1,4);
  35.     PlayersShareView(1,4);
  36.  
  37.     Keltill = GetNamedObj("Keltill");
  38.     Daranix = GetNamedObj("Daranix");
  39.     Dumnorix = GetNamedObj("Dumnorix");
  40.     Pavonius = GetNamedObj("Pavonius");
  41.     Ogox = GetNamedObj("Ogox");
  42.     Mrax = GetNamedObj("Mrax");
  43.     RomanArmy = GetObjSet("PavoniusArmy");
  44.     TeutonArmy = GetObjSet("TeutonArmy");
  45.     TeutonHorde = GetObjSet("TeutonHorde");
  46.     TeutonHorde2 = GetObjSet("TeutonHorde2");
  47.     TeutonHorde3 = GetObjSet("TeutonHorde3");
  48.     GaulsOutpost = GetObjSet("GaulsOutpost");
  49.     rc.Set(9300,3000,10500,4100);
  50.     dummy.AddBuildingsInRect(rc, 1);
  51.     outpost = dummy[0].AsBuilding;
  52.     if (!outpost.IsValid()) pr("The outpost has been moved");
  53.  
  54.     pt.Set(1400,12500);
  55.     View(pt, false);
  56.  
  57. //    determine the state of  conv 14 (roman messenger to pavonius)
  58.     bMessageDelivered = (EnvReadString ("/DM C14/Return Value") == "True");
  59.     bPavoniusHere = (EnvReadString("/DM C1/Return Value") == "stay");
  60.  
  61.     PlaceBlockEx("GArcher", 1, 9600, 4000, 5, 1, 25, 45, "GaulsOutpost");
  62.     GaulsOutpost.AddCommand(true, "enter", outpost );
  63.     GaulsOutpost.KillCommand();
  64.  
  65.     PlaceBlockEx("TeutonWolf", 2, 13650, 1100, 3, 8, 50, 100, "TeutonHorde");
  66.     PlaceBlockEx("TeutonMetal", 2, 13800, 1100, 3, 8, 50, 100, "TeutonHorde");
  67.     nTeutons = 3*8 + 3*8; //total number of teutons
  68.  
  69.     //spawn pavonius and his army if needed
  70.     //if (Pavonius.IsValid)
  71.  
  72.  
  73. //Start conv. 16 - the box is empty
  74.     if (!Daranix.IsDead() && Daranix.obj.AsUnit().FindInvItem("box").IsValid()) {
  75.         Keltill.obj.AddCommand(true, "approach", Daranix.obj);
  76.         while (Keltill.obj.script == "approach" ) Sleep(500);
  77.         conv.Init("DM C16",2, 0);
  78.         conv.Run();
  79.     }
  80.  
  81.  
  82. //if pavonius army is on the map - it comes in the camp
  83. //otherwise if
  84.     if (bPavoniusHere) {
  85.         PlayersShareControl(1,3); //for now we're friends
  86.         //Pavonius.obj.AddCommand(true,"advance", point(1500,12500));
  87.         //Pavonius.obj.KillCommand();
  88.     }
  89.  
  90.  
  91. //give note 7
  92.  
  93.     EnvWriteInt("/NewNote", 7);
  94.     Run("CurrentMap/mission_notes.vs");
  95.  
  96.     while (1) {
  97.         //if (Keltill.obj.AsHero.army.Count() + Daranix.obj.AsHero.army.Count() + Ogox.obj.AsHero.army.Count() > 50) break;
  98.         count=0;
  99.         if (!Daranix.IsDead()) count += Daranix.obj.AsHero.army.Count();
  100.         if (!Ogox.IsDead()) count += Ogox.obj.AsHero.army.Count();
  101.         if (!Dumnorix.IsDead()) count += Dumnorix.obj.AsHero.army.Count();
  102.         if (!Keltill.IsDead()) count += Keltill.obj.AsHero.army.Count();
  103.         if (!Mrax.IsDead()) count += Mrax.obj.AsHero.army.Count();
  104.         if (count > 50) break;
  105.         Sleep(500);
  106.     }
  107.  
  108.  
  109. /*
  110. //after a pause a Teuton army starts entering the map from south.
  111.     Sleep(10000);
  112.  
  113.     PlaceBlockEx("TeutonWolf", 2, 950, 15000, 4, 8, 80, 100, "TeutonArmy");
  114.     TeutonArmy.AddCommandOffset(true,"advance", point(1500,12700));
  115.     TeutonArmy.KillCommand();
  116.  
  117.     //wait for the "warm up" battle to finish
  118.     while (1) {
  119.         if (TeutonArmy.Count() == 0) break;
  120.         Sleep(500);
  121.     }
  122.  
  123. */
  124.  
  125. //    View(point(13650, 1100), false);
  126. //    SetPlayer(2);
  127.     TeutonHorde.AddCommandOffset(true, "advance", point(9600, 4000));
  128.     TeutonHorde.AddCommandOffset(false, "advance", point(6300, 6200));
  129.     TeutonHorde.AddCommandOffset(false, "advance", point(7100, 9000));
  130.     TeutonHorde.KillCommand();
  131.  
  132. //wait for them to pass near the outpost
  133.     rc.Set(10231,3634,10636,4020);
  134.     while (1) {
  135.         if (TeutonHorde.InRect(rc) > 0) break;
  136.         Sleep(500);
  137.     }
  138.  
  139.     View(outpost.pos, false);
  140.  
  141.     Sleep(5000);
  142.     EnvWriteInt("/NewNote", 13);
  143.     Run("CurrentMap/mission_notes.vs");
  144.  
  145. //wait for the battle to start
  146.     while (1) {
  147.         if (TeutonHorde.Count() != nTeutons) break;//someone is killed, therefore the battle has begun
  148.         Sleep(1000);
  149.     }
  150.  
  151.     //pr("battle starts");
  152.  
  153.     //spawn another horde
  154.     PlaceBlockEx("TeutonWolf", 2, 13650, 1100, 3, 8, 50, 100, "TeutonHorde2");
  155.     PlaceBlockEx("TeutonMetal", 2, 13800, 1100, 3, 8, 50, 100, "TeutonHorde2");
  156.     TeutonHorde2.AddCommandOffset(true, "advance", point(9600, 4000));
  157.     TeutonHorde2.AddCommandOffset(false, "advance", point(6300, 6200));
  158.     TeutonHorde2.AddCommandOffset(false, "advance", point(7100, 9000));
  159.     TeutonHorde2.KillCommand();
  160.  
  161.  
  162. //wait the first 10 seconds of the battle, then decide on which side is pavonius
  163.     tmBattle = GetTime();
  164. //    rcBattle.Set(6200,8800,7200,9700);
  165.     bFirst = true;
  166.     bFirst2 = true;
  167.       while (1) {
  168.           if (Keltill.IsDead) break;
  169.           if (TeutonHorde.Count() + TeutonHorde2.Count() + TeutonHorde3.Count() == 0 && !bFirst2) break;
  170.         if (bFirst)
  171.             if (GetTime() - tmBattle > 10000) {
  172.                 bFirst = false;
  173.                 if (bMessageDelivered) {
  174.                     PlayersMakeEnemies(1,3);
  175.                     //todo: players should not share control
  176.                 }
  177.                }
  178.         if (bFirst2)
  179.             if (GetTime() - tmBattle > 5000) {
  180.                 bFirst2 = false;
  181.                 PlaceBlockEx("TeutonWolf", 2, 13650, 1100, 3, 8, 50, 100, "TeutonHorde3");
  182.                 PlaceBlockEx("TeutonMetal", 2, 13800, 1100, 3, 8, 50, 100, "TeutonHorde3");
  183.                 TeutonHorde3.AddCommandOffset(true, "advance", point(9600, 4000));
  184.                 TeutonHorde3.AddCommandOffset(false, "advance", point(6300, 6200));
  185.                 TeutonHorde3.AddCommandOffset(false, "advance", point(7100, 9000));
  186.                 TeutonHorde3.KillCommand();
  187.             }
  188.           Sleep(1000);
  189.       }
  190.  
  191.     if (bMessageDelivered) //== Pavonius is enemy
  192.         while (1) {
  193.             if (Keltill.IsDead) break;
  194.             if (RomanArmy.Count() == 0) break;
  195.             Sleep(500);
  196.         }
  197.  
  198.  
  199. //When no Teuton and Roman units and Roman units if message delivered left on the map, Daranix becomes
  200. //GCH and moves to Keltill. When near, trigger CONVERSATION 17 - You are victorious.
  201.  
  202.     if (!Daranix.IsDead() && !Keltill.IsDead()) {
  203.         Daranix.obj.AddCommand(true, "approach", Keltill.obj);
  204.         Daranix.obj.KillCommand();
  205.         while (Daranix.obj.script == "approach") Sleep(500);
  206.         conv.Init("DM C17", 2, 0);
  207.         conv.Run();
  208.     }
  209.  
  210.     cls();
  211.     pr("This is the end of this demo.");
  212.     pr("Press Alt-F4 to exit.");
  213.  
  214. //End of mission
  215.